#include <bits/stdc++.h>
using namespace std;
int check(char *ch) {
  for (int i = 0; *(ch + i); i++) {
    if (*(ch + i) == '0') return 1;
  }
  return 0;
}
int main() {
  int n, day, counter = 0;
  char str[105];
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> day;
  int consecutive[day], j = 0;
  for (int i = 0; i < day; i++) consecutive[i] = 0;
  cin.ignore();
  for (int i = 1; i <= day; i++) {
    cin >> str;
    int ans = check(&str[0]);
    if (ans == 0)
      j++;
    else
      consecutive[j]++;
  }
  sort(consecutive + 0, consecutive + day);
  cout << consecutive[day - 1];
  return 0;
}
