#include <bits/stdc++.h>
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int i;
  int a[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int low = 0, high, result = 0, times;
  for (i = 1; i < n; i++) {
    if (a[i - 1] == a[i]) {
      high = i - 1;
      if (high - low + 1 > result) {
        result = high - low + 1;
      }
      low = high + 1;
      times++;
    }
  }
  if (n - low > result) {
    result = n - low;
    times++;
  }
  if (times == 0) {
    printf("%d", result);
  }
  printf("%d\n", result);
  return 0;
}
