#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define per(i, a, b) for (int i = (a); i >= int(b); i--)
using namespace std;

typedef long long ll;

const int maxn = 1e5;
int n, L, a[maxn + 5], b[maxn + 5];

void read(int a[], int n) {
	rep(i, 1, n - 1) {
		scanf("%d", &a[i]);
	}
	a[n] = L + 1;
	per(i, n, 1) {
		a[i] = a[i] - a[i - 1] - 1;
	}
}

int main() {
	scanf("%d %d", &n, &L), ++n;
	read(a, n), read(b, n);
	ll res = 0;
	int p = 1;
	rep(i, 1, n) if (b[i] > 0) {
		for (; p < i && a[p] == 0; p++);
		int l = p, c = 0;
		for (; p <= n && c < b[i]; p++) {
			c += a[p];
		}
		if (c > b[i]) {
			puts("-1"), exit(0);
		}
		int r = p - 1;
		res += max(r - i, 0) + max(i - l, 0);
	}
	rep(i, p, n) if (a[i] > 0) {
		puts("-1"), exit(0);
	}
	printf("%lld\n", res);
	return 0;
}
#include "bits/stdc++.h"
using namespace std;

#define rep(i, a, b) for(int i=a; i<=b; i++)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()
#define f first
#define s second
#define nl "\n"
typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1e9+7;
template<class T> using pqg = priority_queue<T,vector<T>,greater<T>>;

int n;
int s[200001];
string t;
vector<int> vec;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // freopen("input.txt", "r", stdin); 
  // freopen("output.txt", "w", stdout);

  cin >> n;
  rep(i, 0, n-1){
    char c; 
    cin >> c;
    s[i]=(c-'0')%7;
  }
  cin >> t;
  
  int mask=1;
  int pten=1;
  for(int i=n-1; i>=0; i--){
    int oldmask=mask;
    rep(k, 0, 6){
      if(oldmask&(1<<k)){
        mask|=(1<<((k+pten*s[i])%7));
      }
    }
    if(i==0 || t[i-1]!=t[i]){
      vec.push_back(mask);
      mask=1;
    }
    pten*=10;
    pten%=7;
  }

  int need=1;
  rep(i, 0, sz(vec)-1) {
    int mask=vec[i];
    int oldneed=need;
    need=0;
    if((t[n-1]=='T' && i%2==0) || (t[n-1]=='A' && i%2==1)){
      rep(j, 0, 6){
        if(!(oldneed&(1<<j))) continue;
        rep(k, 0, 6){
          if(mask&(1<<k)){
            need|=(1<<((j-k+7)%7));
          }
        }
      }
    }
    else{
      rep(j, 0, 6){
        int get=0;
        rep(k, 0, 6){
          if(mask&(1<<k)) get|=(1<<((j+k)%7));
        }
        if(oldneed==(get|(oldneed^get))) need|=(1<<j);
      }
    }
  }

  cout << (need&1?"Takahashi":"Aoki");
}