#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d;
  while (cin >> n >> d) {
    int ans = 0;
    int mx = 0;
    for (int i = 0; i < d; i++) {
      bool f = 0;
      for (int j = 0; j < n; j++) {
        char c;
        cin >> c;
        if (c == '0') f = 1;
      }
      if (f) {
        mx++;
        ans = max(ans, mx);
      } else
        mx = 0;
    }
    cout << ans << endl;
  }
  return 0;
}
