#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 17;
int ans;
int N, K;
int in[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> N >> K;
  for (int i = 1; i <= N; i++) cin >> in[i];
  int last = 0;
  for (int i = 1; i < N; i++)
    if (in[i] == in[i + 1]) ans = max(ans, i - last), last = i;
  ans = max(ans, N - last);
  cout << ans << endl;
  return 0;
}
