#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int l = 1, r = n;
  for (int i = 0; i < m; i++) {
    string s1, s2, s3, s4;
    int id;
    cin >> s1 >> s2 >> s3 >> s4 >> id;
    bool left;
    if (s3 == "left")
      left = 1;
    else
      left = 0;
    if (l <= id && id <= r) {
      if (left)
        r = id - 1;
      else
        l = id + 1;
    } else {
      if ((id < l && left) || (id > r && !left)) {
        cout << -1;
        return 0;
      }
    }
  }
  if (l > r || l > n || r < 1)
    cout << -1;
  else
    cout << r - l + 1;
  return 0;
}
