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



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 ; 
	int j = n-1,i = 0;
	while(i<=n-1 && j>=0){
		if(mat[i][j]>x){
			j--;
		}
		else{
			count+=j+1;
			i++;
			
		}
		
	}
	cout<<count;
	return 0;
}