#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include using namespace std; int dp[1010][1010]; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); rep(i,1010) rep(j,1010) dp[i][j]=-1; int n,I; cin>>n>>I; vector S(n),A(n); rep(i,n) cin>>S[i]>>A[i]; dp[0][0]=0; for(int i=0;i