#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < (long long)n; i++) cin >> a[i];
  long long x = 0, c = 0;
  for (long long i = 1; i < (long long)n; i++)
    if (a[i] == a[i - 1]) {
      c = max(c, i - x);
      x = i;
    }
  c = max(c, n - x);
  cout << c;
  return 0;
}
