水题一道。。话说我目前的水平只能刷水题,先把ZOJ水题刷个遍,哈哈
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
while (true)
{
int n = sc.nextInt();
int m = sc.nextInt();
if (n == 0 && m == 0)
break;
int[] array = new int[n];
for (int i = 0; i < m; i++)
{
int number = sc.nextInt();
array[number - 1]++;
}
int r = 0;
for (int i = 0; i < array.length; i++)
{
if (array[i] > 1)
r++;
}
System.out.println(r);
}
}
}