#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long mod = 1000000007;
int main(int argc, char** argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int cant = n;
  int ans = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (i != n - 1 && a[i] == a[i + 1]) cant = i + 1;
    ans = max(ans, cant - i);
  }
  cout << ans << '\n';
  return 0;
}
