#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n,x;cin >> n >> x;
    vector<int> a(n),b(n),c,d;
    int total = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] -= x;
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
        if (a[i] < 0) {
            c.push_back(-a[i]);
            d.push_back(b[i]);
        }
        else {
            total += a[i];
        }
    }
    int INF = 1e9 + 6;
    
    vector<vector<int>> dp(c.size()+1,vector<int>(total+1,INF));
    dp[0][0] = 0;
    for (int i = 0; i < c.size(); i++) {
        for (int j = 0; j <= total; j++) {
            if (dp[i][j] != INF) dp[i + 1][j] = dp[i][j] + d[i];
            if (j-c[i] >= 0) dp[i + 1][j] = min(dp[i+1][j],dp[i][j-c[i]]);
        }
    }
    int ans = INF;
    for (int i = 0; i <= total; i++) {
        ans = min(ans,dp[c.size()][i]);
    }
    if (ans == INF || c.size() == n) {
        puts("-1");
    }
    else {
        cout << ans << endl;
    }
    return 0;
}