• [J] Jokes

  • 时间限制: 1000 ms 内存限制: 6000 K
  • 问题描述
  • Mr. Cai loves to tell some jokes to TT.
    As Mr. Cai don't have too much jokes, he may tell one joke again and again.

    Fortunately, TT's memory is not that good. That means she can only remember recently M 'new jokes'. Even if she remembered one joke, she won't deepen impression for this joke.
    Mr. Cai tell one joke per day. And during N days, can you calculate out how many 'new jokes' TT has heard?

  • 输入
  • This problem contains several cases.
    The first line of each case is two integers N and M. (1 <= M, N <= 1 000 000)
    Then follows a line with N integers, each integer is between 0 and 1 000 000.
  • 输出
  • For each case, you should output the number of 'new jokes' that TT has heard during those days.
  • 样例输入
  • 9 5
    1 2 3 4 5 1 6 1 2
    
  • 样例输出
  • 8
  • 提示
  • 来源
  • XadillaX
  • 操作

显示春菜