#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5, M = 998244353;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  long long n, m, k, i, t, ans = 1, j, x = 0, y = 0, z, c = 1;
  cin >> n >> m;
  long long a[n];
  cin >> a[0];
  for (i = 1; i < n; i++) {
    cin >> a[i];
    if (a[i] != a[i - 1])
      c++;
    else {
      ans = max(ans, c);
      c = 1;
    }
  }
  ans = max(ans, c);
  cout << ans;
}
