#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define pii pair<ll,ll>
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define autoitr(x,it) for(auto it = x.rbegin(); it != x.rend(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
  FAST/**/
  
  ll n,m;
  cin>>n>>m;
  
  ll lim = (1ll<<m);
  string arr[n];
  rep(n)
        cin>>arr[i];
  ll num[n];
  rep(n)
  {
      num[i] = 0;
      for(auto x : arr[i])
            num[i] = 2*num[i] + (x == '1');    
  }
  
  map<ll,ll> ma;
  rep(n)
        ma[bpc(num[i])%2]++;
  ll ans = ma[0]*ma[1];
  cout<<ans<<'\n';
  
  
  return 0;
}
   
   
 
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=(n)-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={-1,0,1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template <typename T> inline bool chmax(T &a, T b) {
  return ((a < b) ? (a = b, true) : (false));
}
template <typename T> inline bool chmin(T &a, T b) {
  return ((a > b) ? (a = b, true) : (false));
}
int main(){
  ll n,k;cin >> n >>k;
  vvl dp(4,vl(3*n));dp[0][0]=1;
  rep(i,3){
    rep(j,3*n){
      if(dp[i][j]){
        dp[i+1][j]+=dp[i][j];dp[i+1][j+n]-=dp[i][j];
      }
    }
    rep(j,3*n-1)dp[i+1][j+1]+=dp[i+1][j];
  }
 // rep(j,3*n)cout << dp[3][j] <<" ";cout << endl;
 ll cost=0,sum=-1;
 rep(i,3*n){
   cost+=dp[3][i];
   if(cost>=k){
     k-=cost-dp[3][i];
     sum=i;break;
   }
 }
 cost=0;
 rep(i,n){
  ll rem=sum-i;
  ll left=rem-(n-1),right=rem;
  left=max(left,0LL),right=min(right,n-1);
  ll p=max(right-left+1,0LL);
  //cout << (right-left+1) <<endl;
  if(k<=cost+p){
    cout << i+1 <<" ";
    ll cnt=0;
    rep(j,n){
      if(rem-j<=n-1){
        cnt++;
        if(k==cost+cnt){
          cout << j+1 <<" " << rem-j+1 <<endl;
          return 0;
        }
      }
    }
  }
  cost+=p;
 }
 //cout << sum <<" " << k <<endl;

}   