#include <bits/stdc++.h>
using namespace std;
int main() {
  int size;
  cin >> size;
  int mass[size];
  for (int i = 0; i < size; i++) mass[i] = 0;
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    string a, b, c;
    string move;
    int coordinate;
    cin >> a >> b >> move >> c >> coordinate;
    coordinate--;
    if (move == "left") {
      for (int i = coordinate; i < size; i++) mass[i] = -1;
    } else if (move == "right") {
      for (int i = 0; i <= coordinate; i++) mass[i] = -1;
    }
  }
  int counter = 0;
  for (int i = 0; i < size; i++)
    if (mass[i] == -1) counter++;
  if (counter == size) {
    cout << -1;
    return 0;
  }
  int answer = 0;
  for (int i = 0; i < size; i++)
    if (mass[i] == 0) answer++;
  cout << answer << endl;
  return 0;
}
