#include <bits/stdc++.h>
using namespace std;
void maxFunc(int *maxIs, int data) {
  if (*maxIs < data) *maxIs = data;
}
int main() {
  int n_h, n_c;
  cin >> n_h;
  assert(n_h >= 1 && n_h <= 100000);
  cin >> n_c;
  assert(n_c >= 1 && n_c <= 100000);
  int house[n_h], var;
  for (int i = 0; i < n_h; i++) {
    cin >> var;
    if (var <= n_c) {
      house[i] = var;
    }
    assert(var <= n_c);
  }
  int countIs = 1, maxIs = 1;
  for (int i = 0; i < n_h; i++) {
    if (i + 1 < n_h) {
      if (house[i] != house[i + 1]) {
        countIs += 1;
        maxFunc(&maxIs, countIs);
      } else
        countIs = 1;
    }
  }
  cout << maxIs;
}
