#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, q;
  cin >> n >> q;
  long long left = 1, right = n;
  while (q--) {
    string a, b;
    cin >> a >> a >> a >> b;
    long long value;
    cin >> value;
    if (a == "left") {
      long long Z = value - 1;
      right = min(right, Z);
    } else {
      long long Z = value + 1;
      left = max(left, Z);
    }
  }
  if (left >= 1 && left <= n && right >= 1 && right <= n && left <= right) {
    cout << right - left + 1 << endl;
    return 0;
  }
  cout << -1 << endl;
}
