#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int n,m,num[105][105],ans=0;
char s[105][105];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s[i]);
		for(int j=1;j<=m;j++)
		{
			if(s[i][j-1]=='#')continue;
			if(i>1&&s[i][j-1]==s[i-1][j-1])ans++;
			if(j>1&&s[i][j-1]==s[i][j-2])ans++;
		}
		
		
	}
	printf("%d",ans);
	return 0;
}
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

ll dp[101][101];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	ll N, X;
	cin >> N >> X;
	int A[100];
	rep(i, N) cin >> A[i];

	ll kotae = 2e18;
	ll b = 0;
	rep1(s, N) {
		b += 2000000000;
		ll amari = X % s;
		dp[0][0] = b;
		rep(i, N) {
			ce(i);
			for (int j = min(i, s - 1); j >= 0; j--) {
				int t0 = A[i] % s;
				int t = t0;
				rep(k, s - t0) {
					if (dp[j][k] >= b) chmax(dp[j + 1][t], dp[j][k] + A[i]);
					t++;
				}
				t -= s;
				for (int k = s - t0; k < s; k++) {
					if (dp[j][k] >= b) chmax(dp[j + 1][t], dp[j][k] + A[i]);
					t++;
				}
			}
		}
		if (dp[s][amari] >= b) {
			chmin(kotae, (X - dp[s][amari] + b) / s);
		}
	}
	co(kotae);

	Would you please return 0;
}