#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, beat = 0, counts = 0, maxcount = 0, lbeat = 0;
  cin >> n >> d;
  char str[n];
  for (int i = 0; i < d; i++) {
    if (lbeat == 0) counts = 0;
    lbeat = 0;
    cin >> str;
    for (int j = 0; j < n; j++) {
      beat = 0;
      if (str[j] == '0') {
        lbeat = 1;
        beat = 1;
        break;
      }
    }
    if (beat == 1) counts++;
    if (counts > maxcount) maxcount = counts;
  }
  cout << maxcount;
}
