#include <bits/stdc++.h>
int main() {
  int a, b, i, j, ar[500000], s = 1, v = 0, z[500000], max;
  scanf("%d%d", &a, &b);
  for (i = 0; i < a; i++) {
    scanf("%d", &ar[i]);
  }
  j = 0;
  while (j < a - 1) {
    if (ar[j] != ar[j + 1]) s++;
    if (ar[j] == ar[j + 1]) {
      z[v] = s;
      s = 1;
      v++;
    }
    j++;
  }
  max = s;
  for (j = 0; j < v; j++) {
    if (z[j] > max) max = z[j];
  }
  printf("%d", max);
  return 0;
}
