#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265359;
int main() {
  int n;
  long long p;
  cin >> n >> p;
  p /= 2;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (s == "half")
      a.push_back(0);
    else
      a.push_back(1);
  }
  long long tek = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] == 1)
      tek = (tek + 1) * 2LL;
    else
      tek = tek * 2LL;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (tek % 2 == 0 && tek % 4 != 0) {
      ans += (tek / 2) * p;
      tek = tek / 2 - 1;
    } else {
      ans += (tek / 2) * p;
      tek = tek / 2;
    }
  }
  assert(tek == 0);
  cout << ans;
  return 0;
}
