#include <bits/stdc++.h>
using namespace std;
void Fast() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
inline int RD() {
  int i;
  cin >> i;
  return i;
}
inline float RF() {
  float i;
  cin >> i;
  return i;
}
inline double RDO() {
  double i;
  cin >> i;
  return i;
}
inline string RS() {
  string i;
  cin >> i;
  return i;
}
inline long long RLL() {
  long long i;
  cin >> i;
  return i;
}
int cm[200000];
long long sumSet(long long n) { return (1ll * n * (n + 1)) / 2; }
string s;
bool isPrime(int n) {
  if (n == 1) return false;
  for (int i = 2; i * i <= n; ++i) {
    if (n % i == 0) return false;
  }
  return true;
}
int sumDigit(int n) {
  int sum = 0;
  while (n != 0) {
    sum += +n % 10;
    n = n / 10;
  }
  return sum;
}
long long power2(int n) {
  long long ans = (1 << n);
  return ans;
}
long long sumpow2(long long n) {
  long long sum = (n * (n + 1) * (2 * n - 1)) / 6;
  return sum;
}
char arr[101][101];
int main() {
  Fast();
  int n = RD(), m = RD(), x, arr[1002] = {}, ans = 0;
  string s, s1, t, t1;
  for (int i = 0; i < n; ++i) {
    arr[i] = 1;
  }
  for (int i = 0; i < m; ++i) {
    cin >> t >> t1 >> s >> s1;
    cin >> x;
    if (s == "right") {
      for (int j = x - 1; j >= 0; --j) arr[j] = -1;
    } else if (s == "left") {
      for (int j = x - 1; j < n; ++j) arr[j] = -1;
    }
  }
  for (int i = 0; i < n; ++i) {
    if (arr[i] == 1) ans++;
  }
  if (ans == 0)
    cout << "-1";
  else
    cout << ans;
}
