#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int bs(int i , vector<vector<int>>&mat,int x){
	int n = mat[i].size();
	int low = 0, high = n-1;
	int ans = INT_MIN;
	while(low<=high){
		//try to find the last element in the sorted row whose value is less 
		// than equal to x 
		int mid = (low+high)/2;
		if(mat[i][mid]<=x){
			low = mid+1;
			ans = max(ans,mid);
		}
		else{
			high = mid-1;
		}
	}
	return ans+1 ;
}

int main() {
	// your code goes here
	int n ; 
	cin>>n;
	int x ; cin>>x;
	vector<vector<int>>mat(n,vector<int>(n,0));
	for(int i = 0 ; i<n;i++){
		for(int j = 0; j<n;j++){
			cin>>mat[i][j];
		}
	}
	
	int count = 0 ; 
	for(int i = 0 ; i<n;i++){
		count = count + bs(i,mat,x);
	}
	cout<<count;
	return 0;
}