#include <bits/stdc++.h>
using namespace std;
const int MAGIC_NUMBER = 1;
using dint = uint64_t;
dint INF = 1000000;
void readData();
void answerReqs();
void printState();
int main() { readData(); }
multiset<char> oleg;
multiset<char, greater<char>> petr;
int resSize = 0;
void printState() {
  for (auto &v : oleg) {
    cout << v << " ";
  }
  cout << endl;
}
void answerReqs() {
  string res1, res2;
  int cnt = 0;
  while (cnt < resSize) {
    cnt++;
    if (*oleg.begin() < *petr.begin()) {
      res1.push_back(*oleg.begin());
      oleg.erase(oleg.begin());
    } else {
      res2.push_back(*oleg.rbegin());
      oleg.erase(prev(oleg.end()));
    }
    if (cnt == resSize) {
      cnt++;
      continue;
    }
    cnt++;
    if (*oleg.begin() <= *petr.begin()) {
      res1.push_back(*petr.begin());
      petr.erase(petr.begin());
    } else {
      res2.push_back(*petr.rbegin());
      petr.erase(prev(petr.end()));
    }
  }
  reverse(res2.begin(), res2.end());
  cout << res1 << res2 << endl;
}
void readData() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string o, p;
  int n, m;
  cin >> n >> m;
  int l = 0;
  int r = n + 1;
  int cnt = 0;
  for (int i = 0; i < m; ++i) {
    cin >> o >> o >> p >> o >> cnt;
    if (p == "left") {
      r = min(r, cnt);
    } else {
      l = max(l, cnt);
    }
  }
  if (l >= r - 1) {
    cout << -1 << endl;
  } else {
    cout << r - 1 - l << endl;
  }
}
