#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  ios_base::sync_with_stdio(0);
  int n, k, ans = 1;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i < n; i++) {
    while (i < n && a[i - 1] == a[i]) i++;
    if (i == n) break;
    int res = 1;
    while (i < n && a[i - 1] != a[i]) {
      res++;
      i++;
    }
    ans = max(ans, res);
  }
  cout << ans << endl;
  return 0;
}
