#include <bits/stdc++.h>
using namespace std;
vector<pair<int, bool>> houses;
int n, k, tmp;
int main() {
  scanf("%d%d", &n, &k);
  int simpan = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &tmp);
    if (tmp == simpan) {
      houses[i - 1].second = false;
    }
    houses.push_back({tmp, true});
    simpan = tmp;
  }
  int maxHouse = 0, tmp2 = 0;
  for (int i = 0; i < houses.size(); i++) {
    tmp2++;
    if (!houses[i].second || (i == houses.size() - 1 && houses[i].second)) {
      maxHouse = max(maxHouse, tmp2);
      tmp2 = 0;
    }
  }
  printf("%d\n", maxHouse);
}
