#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int maxn = 1;
  int pos = 1;
  for (int i = 2; i <= n; i++) {
    if (a[i] == a[i - 1]) {
      maxn = max(maxn, i - pos);
      pos = i;
    }
  }
  maxn = max(maxn, n - pos + 1);
  printf("%d\n", maxn);
  return 0;
}
