#include <bits/stdc++.h>
using namespace std;
vector<int> V, B;
set<string> S;
queue<int> Q;
deque<int> D;
int n, x, a, b, c, cnt, ans, l, r, m, d;
string s;
char arr[100][100];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> x, V.push_back(x);
  if (n == 1) {
    cout << 1;
    return 0;
  }
  for (int i = 1; i < n; i++) {
    if (V[i] == V[i - 1])
      B.push_back(cnt + 1), cnt = 0;
    else
      cnt++;
  }
  B.push_back(cnt + 1);
  sort(B.begin(), B.end());
  reverse(B.begin(), B.end());
  cout << B[0];
}
