use std::io::{self, BufRead, Write}; use std::str::FromStr; use std::fmt; struct Io1(T); impl FromStr for Io1 { type Err = String; fn from_str(s: &str) -> Result { Ok(s.trim_end().parse().ok().unwrap()) } } struct Io2(T1, T2); impl FromStr for Io2 { type Err = String; fn from_str(s: &str) -> Result { let mut iter = s.split_whitespace(); Ok(Io2( iter.next().unwrap().parse().ok().unwrap(), iter.next().unwrap().parse().ok().unwrap(), )) } } struct Io3(T1, T2, T3); impl FromStr for Io3 where T1: FromStr, T2: FromStr, T3: FromStr { type Err = String; fn from_str(s: &str) -> Result { let mut iter = s.split_whitespace(); Ok(Io3( iter.next().unwrap().parse().ok().unwrap(), iter.next().unwrap().parse().ok().unwrap(), iter.next().unwrap().parse().ok().unwrap(), )) } } struct Ios(Vec); impl std::str::FromStr for Ios { type Err = String; fn from_str(s: &str) -> Result { Ok(Ios(s.chars().collect())) } } impl fmt::Display for Ios { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.0.iter().collect::()) } } struct Iov(Vec); impl FromStr for Iov { type Err = String; fn from_str(s: &str) -> Result { let iter = s.split_whitespace(); Ok(Iov(iter.map(|x| x.parse().ok().unwrap()).collect())) } } impl fmt::Display for Iov { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.0.iter().map(|x| x.to_string()) .collect::>().join(" ") ) } } use std::collections::HashMap; struct Solver<'a> { reader: io::BufReader>, writer: io::BufWriter>, } impl Solver<'_> { fn read(&mut self) -> T { let mut input = String::new(); self.reader.read_line(&mut input).unwrap(); input.trim_end().parse().ok().unwrap() } fn writeln(&mut self, ans: T) { writeln!(self.writer, "{}", ans).unwrap(); } fn rec( n: usize, a: &Vec, map: &mut HashMap, v: i64, mut state: i32, flag: bool ) -> bool { if v < 0 { return flag; } if let Some(value) = map.get(&state) { return *value; } for i in 0..n { if state & 1 << i != 0 { continue; } state |= 1 << i; let value = Self::rec(n, a, map, v - a[i], state, !flag); map.insert(state, value); if value == flag { return flag; } state ^= 1 << i; } !flag } fn solve(&mut self) { let Io2(n, v): Io2 = self.read(); let Iov(a): Iov = self.read(); if a.iter().sum::() <= v { self.writeln("Draw"); } let mut map = HashMap::new(); if Self::rec(n, &a, &mut map, v, 0, true) { self.writeln("First"); } else { self.writeln("Second"); } } fn run() { let (stdin, stdout) = (io::stdin(), io::stdout()); let reader = io::BufReader::new(stdin.lock()); let writer = io::BufWriter::new(stdout.lock()); let mut solver = Solver { reader, writer }; solver.solve(); } } fn main() { Solver::run(); }