#include <bits/stdc++.h>
using namespace std;
int N, K, Cnt = 1, Max = -1;
int ar[110000], check[110000];
int main() {
  cin >> N >> K;
  for (int x = 1; x <= N; x++) cin >> ar[x];
  for (int x = 1; x < N; x++) {
    if (ar[x] == ar[x + 1]) {
      check[Cnt++] = x;
    }
  }
  check[Cnt++] = N;
  for (int x = 1; x < Cnt; x++) {
    if (Max < check[x] - check[x - 1]) {
      Max = check[x] - check[x - 1];
    }
  }
  cout << Max;
  return 0;
}
