#include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() using namespace std; typedef long long ll; typedef pair pi; typedef pair pl; typedef pair pls; int main() { int n; ll k; string s; cin >> n >> k >> s; s += s; ll num = 1; for (int i = 0; i < n*2-1; i++) { if (s[i] == '2' && s[i + 1] == '0') { s[i + 1] = '1'; } } for (int i = 1; i < n; i++) { if (s[i - 1] == '0')num++; } ll ans = 0; if (n < k) { int buy[110],buy_num=0; int nes = (k - n)/n; for (int i = n; i < n * 2; i++) { if (s[i - 1] == '0') { buy[i] = 1; buy_num++; } } ans += nes * buy_num; for (int i = n; i < (n + (k - n) % n)-1; i++) { if (buy[i])ans++; } } else { num = 1; for (int i = 1; i < n; i++) { if (s[i - 1] == '0') { num++; } } } cout << ans + num << endl; return 0; }