#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, d, cont = 0, maior_cont = 0;
  string s;
  cin >> n >> d;
  while (d--) {
    cin >> s;
    int temp = cont;
    for (i = 0; i < n; i++) {
      if (s[i] != '1') {
        cont++;
        break;
      }
    }
    if (cont > maior_cont) maior_cont = cont;
    if (temp == cont) cont = 0;
  }
  cout << maior_cont << endl;
  return 0;
}
